home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / utility / fsco3712.zip / FSCODE.DOC < prev    next >
Text File  |  1994-01-30  |  5KB  |  130 lines

  1.  
  2.    NAME
  3.     FSCode -- Encode a binary file using only ASCII characters (V37)
  4.  
  5.    SYNOPSIS
  6.     FSCode FILE/A,TO,E=ENCODE/S
  7.  
  8.    FUNCTION
  9.     FSCode was born to be a more efficient replacement for UUencode; it's
  10.     purpose is to encode a binary file (an executable, for example, or an
  11.     archive such as those made by Zip or LhA) using only the standard
  12.     ASCII character set, i.e. the characters between 32 and 126.
  13.  
  14.     UUencode encodes 3 bytes into 4 characters, enlarging a file by 33%;
  15.     FSCode does a better job by encoding 4 bytes (a longword) into 5
  16.     characters: the enlargement is only 25%.  This theoretical figure
  17.     does not take into account a couple of control lines and the line
  18.     feeds used to subdivide the resulting file, and two more control
  19.     characters per line needed by UUencode; the real enlargement tends to
  20.     26.6...% for FSCode and to 37.7...% for UUencode.
  21.  
  22.     It must be made clear that the information contained in the encoded
  23.     files is exactly the same, so if you use UUencode or FSCode to send
  24.     binary files into electronic mail messages, that will be then
  25.     compressed, the size of the resulting packets will be very similar,
  26.     in perfect accordance to the information theory.  The advantage is
  27.     that the readable message stored on your disks will take less space,
  28.     and that you will be able to send bigger files when there is a limit
  29.     on the size of a single message.
  30.  
  31.     One more advantage of FSCode over UUencode is that it uses a 32-bit
  32.     CRC to check the correctness of the decoded file; one disadvantage is
  33.     that it doesn't use a per-line checksum, so you won't know exactly
  34.     where the file was corrupted.
  35.  
  36.    INPUTS
  37.     FILE - Input file to encode (if the ENCODE switch is used) or decode.
  38.  
  39.     TO - Optional output file for the encoded or decoded data.
  40.         If the destination file is omitted, FSCode will send it's output
  41.         to the standard output when encoding, or to the file name
  42.         specified in the encoded file when decoding.
  43.  
  44.     ENCODE - A switch that instructs FSCode to encode the input file.
  45.         By default FSCode will try to decode an already encoded file and
  46.         reproduce the original data.
  47.  
  48.    RESULT
  49.     FSCode will output a file that looks like this:
  50.  
  51.         !start Example
  52.         E4x~n4MPvGMo9KC4L]7:J^.a,N5B2E###*4
  53.         !end 25 4E9AB940
  54.  
  55.     The first line contains the file name, without drive/directory
  56.     specifications.  This is to prevent both errors when trying to decode
  57.     a file produced on a system different than yours and funny things
  58.     like overwriting system files.  The decoding process actually uses
  59.     the complete file name, without removing the drive/directory part
  60.     that might have been added after the encoding:  this is to ease the
  61.     creation of scripts and such things for automatic decoding.
  62.  
  63.     The last line contains the size (in decimal) and the 32-bit CRC (in
  64.     hexadecimal) of the original file.
  65.  
  66.     Should FSCode fail for any reason, an (hopefully) meaningful message
  67.     will be printed on your screen.  Examples include `No start line' or
  68.     `CRC mismatch' or `Can't open file <file name>'.
  69.  
  70.    NOTES
  71.     FSCode is absolutely tolerant on what you do to the encoded lines,
  72.     provided that you do not add or remove characters in the range from
  73.     33 to 126 [!-~].  You can reflow the lines and insert spaces, line
  74.     feeds or other control characters freely.
  75.  
  76.     The absence of the !end line does not influence the correctness of
  77.     the decoded file.  Of course you miss the size and CRC check, but
  78.     otherwise the decoding process is not influenced.
  79.  
  80.     For a deeper description of the encoding algorithm, see the file
  81.     `Specs.Doc' and the source code.
  82.  
  83.    NOTES ON THE SOURCE CODE
  84.     The included source code is completely in C, but the executable is
  85.     really made from assembly source generated from the compiler output
  86.     and optimized by hand, which improves encoding speed by about 15%.
  87.  
  88.     I won't spread the assembly source because I'm not very comfortable
  89.     at working on it (particularly when it's debugging time), so I prefer
  90.     to make improvements on the C source and then propagate them to the
  91.     assembly version after they have been tested; it is obvious that
  92.     distributing the assembly source would break this process.
  93.  
  94.    DISTRIBUTION
  95.     This program is freeware.  You may redistribute it as long as:
  96.      - this text and the source code are included;
  97.      - you don't charge more than a nominal copying fee for distribution.
  98.  
  99.     Please state your modifications to the code with a clear comment, and
  100.     send me your modified version.  It would be a good idea to include
  101.     the original code, anyway.
  102.  
  103.     Any contribution will be greatly appreciated (I'm a poor engineering
  104.     student, you know).
  105.  
  106.    DISCLAIMER
  107.     The author does not assume any responsibility for damages which could
  108.     result by the use of this program.  The entire risk for the use of
  109.     this program is assumed by the user.
  110.  
  111.    AUTHOR
  112.     Flavio Stanchina
  113.     Loc. Montevaccino, 39
  114.     38040 Trento (Italia)
  115.  
  116.     email: 2:333/408.9@fidonet.org
  117.  
  118.    ACKNOWLEDGEMENTS
  119.     Thanks to Gian Maria Calzolari (2:332/508.19@fidonet.org) for beta
  120.     testing and suggestions, and for writing a new ExtractFile.ems ARexx
  121.     script for EMS that supports both UUencode and FSCode.
  122.  
  123.     Thanks to Marco Amadori (2:333/408.23@fidonet.org) for beta testing.
  124.  
  125.     Thanks to Sandro Tolaini (2:332/113.3@fidonet.org) for a bug report.
  126.  
  127.     And finally thanks to all the participants of the AMIGA.ITA Fidonet
  128.     conference for suggestions and encouragement.
  129.  
  130.